package homeWork.Three.demo5;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: sfx
 * Date: 2022-11-30
 * Time: 17:33
 */

class Student{
    private int id;
    private String name;
    private double score;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return "学生信息 : {" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", score=" + score +
                '}';
    }
}

public class TestDemo {

    public static void main(String[] args) {
        System.out.println("请输入学生的个数");
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Student[] students = new Student[n];
        for(int i = 0;i<n;++i){
            //构造学生信息并输出
            Student student = new Student();
            System.out.println("输入学生id");
            int id  = scanner.nextInt();
            student.setId(id);
            System.out.println("输入学生名字");
            String name =scanner.next();
            student.setName(name);
            System.out.println("输入学生分数");
            double score = scanner.nextDouble();
            student.setScore(score);
            System.out.println(student);
        }
    }
}
